<?php
namespace app\index\controller;
use think\Controller;
use think\Request;
use think\Cookie;
use Storage;
class Index extends Common
{
    public function index()
    {
    	
    		//////////////////////////////////
    		$news=array();
    		$indexAd=array();
    		$url1=config('tdwApi')."/index/getData.jhtml";
    		$res1=$this->http($url1);		
    		$res1=json_decode($res1[0],true);
    		if($res1['code']==1){
    			$news=$res1['data']['array'];
    		}
    		$url2=config('tdwApi')."/ad/getIndexAd.jhtml";		
    		$res2=$this->http($url2);		
    		$res2=json_decode($res2[0],true);		
    		if($res2['code']==1){
    			$indexAd=$res2['data']['imageArray'];
    		}
    		return view('index/index',['act'=>'index','news'=>$news,'indexAd'=>$indexAd]);
    		/////////////////////////////////
	}
	public function indexHtml(){
		$news=array();
		$indexAd=array();
		$url1=config('tdwApi')."/index/getData.jhtml";		
		$res1=$this->http($url1);		
		$res1=json_decode($res1[0],true);
		if($res1['code']==1){
			$news=$res1['data']['array'];
		}
		$url2=config('tdwApi')."/ad/getIndexAd.jhtml";		
		$res2=$this->http($url2);		
		$res2=json_decode($res2[0],true);		
		if($res2['code']==1){
			$indexAd=$res2['data']['imageArray'];
		}
		$this->assign('act','index');		
		$this->assign('news',$news);		
		$this->assign('indexAd',$indexAd);		
		$html = $this->buildHtml('index','./',"index",'utf8');
		if($html){
			$data['code']=200;
			$data['msg']="生成成功";
		}else{
			$data['code']=500;
			$data['msg']="生成失败";
		}
		echo json_encode($data);	
	}
	public function notice(){
		$url=config('tdwApi')."/ordersPool/list.jhtml";
		$res=$this->http($url);
		$res=json_decode($res[0],true);
		$url2=config('tdwApi')."/ordersPool/findListOrderByPool.jhtml";
		$res2=$this->http($url2);
		$res2=json_decode($res2[0],true);
		return view('index/notice',['act'=>'notice','data'=>$res,'data2'=>$res2]);			
	}
	
}
